#include "../compile_server/compile_run.hpp"
#include <jsoncpp/json/json.h>
/* 单元测试compile_run */
using namespace ns_compile_run;

int main()
{
    /* 序列化代码与运行环境 */
    std::string in_json;
    Json::Value in_root;
    in_root["code"] = R"(#include<iostream>
    int main(){
        std::cout << "hello world" << std::endl;

        return 0;
    })";
    in_root["input"] = "";
    in_root["cpu_limit"] = 2;
    in_root["mem_limit"] = 1024*20;
    Json::FastWriter writer;
    in_json = writer.write(in_root);
    std::cout << in_json << std::endl;

    /* 反序列化结果 */
    std::string out_json;
    CompileAndRun::start(in_json, &out_json);
    std::cout << out_json << std::endl;

    return 0;
}